package com.smart.daotest;

import com.smart.dao.TeacherDao;
import com.smart.domain.Teacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests;
import org.testng.annotations.Test;

@ContextConfiguration("classpath*:/Room-context.xml")

@Rollback(false)

public class Testteacher extends AbstractTransactionalTestNGSpringContextTests {
    @Autowired
    private TeacherDao teacherDao;


    @Test
    public void testteacheradd(){
        Teacher teacher =new Teacher();
        teacher.setName("林老师");
        teacher.setDepartment("教务处");
        teacher.setUserName("ben");
        teacher.setPassword("1314520");
        teacher.setEmail("123456789@qq.com");
        teacher.setPhoneNumber("123456789");
        teacher.setUser_tye(1);
        teacherDao.addteacher(teacher);
    }



    @Test
    public void testdeleteteacher(){
        Teacher teacher =new Teacher();
        teacher.setName("王路");
        teacherDao.deleteteacher(teacher);
    }

    @Test
    public void testupdateteacher(){
        Teacher teacher =new Teacher();
        teacher.setName("林");
        teacher.setDepartment("艺术学院");
        teacher.setUserName("lin");
        teacher.setPassword("1234567");
        teacher.setEmail("1234567890@qq.com");
        teacher.setPhoneNumber("1234567890");
        teacherDao.updateteacher(teacher);
    }

    @Test
    public void testquetyteacher(){
        Teacher teacher =new Teacher();
       String name="wanglu";
        teacherDao.queryteacher(name);
    }
    @Test
    public void testquetyteacherlist(){
        Teacher teacher =new Teacher();

        teacherDao.queryteacherlist(teacher);
    }
}


